package com.controller.page;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.entity.ChanPing;
import com.entity.ChanPingFenLei;
import com.entity.FuJian;
import com.entity.QiYe;
import com.entity.XinWenLanMu;
import com.entity.XinWenZiXun;
import com.entity.YongHu;
import com.service.ChanPingFenLeiService;
import com.service.ChanPingService;
import com.service.FuJianService;
import com.service.QiYeService;
import com.service.XinWenLanMuService;
import com.service.XinWenZiXunService;
import com.service.YongHuService;


@Controller
@RequestMapping("/page")
public class PageController {
	
	@Autowired
	private XinWenLanMuService xwlmService;
	@Autowired
	private XinWenZiXunService xwzxService;
	@Autowired
	private ChanPingFenLeiService cpflService;
	@Autowired
	private ChanPingService cpService;
	@Autowired
	private FuJianService fjService;
	@Autowired
	private YongHuService yhService;
	@Autowired
	private QiYeService qyService;

	/**
	 * 跳转主页
	 * @param md
	 * @return
	 */
	@RequestMapping("/zy")
	public String zy(Model md){
		FuJian fj = new FuJian();
		fj.setFjwjm("1");
		List<FuJian> fjList = fjService.find(fj);
		md.addAttribute("fjList",fjList);
		return "page/zy";
	}

	/**
	 * 跳转注册状态-所有
	 * @param md
	 * @return
	 */
	@RequestMapping("/zcztsy")
	public String zcztsy(Model md){
		QiYe o = new QiYe();
		List<QiYe> qyList = qyService.find(o);
		md.addAttribute("qyList",qyList);
		return "page/zcztsy";
	}
	/**
	 * 跳转金融机构
	 * @param md
	 * @return
	 */
	@RequestMapping("/jrjg")
	public String jrjg(Model md){
		YongHu yh = new YongHu();
		yh.setQymc("金融机构");
		List<YongHu> yhList = yhService.find(yh);
		md.addAttribute("yhList",yhList);
		return "page/jrjg";
	}
	/**
	 * 跳转关于我们
	 * @param md
	 * @return
	 */
	@RequestMapping("/gywm")
	public String gywm(Model md){
		ChanPing cp = new ChanPing();
		cp.setId("1");
		List<ChanPing> cpList = cpService.find(cp);
		for (int i = 0; i < cpList.size(); i++) {
			cp=cpList.get(i);
		}
		md.addAttribute("cp",cp);
		return "page/gywm";
	}
	/**
	 * 跳转产品详情
	 * @param md
	 * @return
	 */
	@RequestMapping("/cpxq")
	public String cpxq(Model md){
		ChanPing cp = new ChanPing();
		cp.setId("1");
		List<ChanPing> cpList = cpService.find(cp);
		for (int i = 0; i < cpList.size(); i++) {
			cp=cpList.get(i);
		}
		md.addAttribute("cp",cp);
		return "page/cpxq";
	}
	/**
	 * 跳转新闻详情
	 * @param md
	 * @return
	 */
	@RequestMapping("/xwxq")
	public String xwxq(Model md){
		XinWenZiXun xw = new XinWenZiXun();
		xw.setId("2");
		List<XinWenZiXun> xwList = xwzxService.find(xw);
		XinWenZiXun tp = new XinWenZiXun();
		for (int i = 0; i < xwList.size(); i++) {
			tp=xwList.get(i);
			System.out.println("xwxw"+tp);
		}
		FuJian fj = new FuJian();
		fj.setId(tp.getFmtp());
		List<FuJian> fjList=fjService.find(fj);
		for (int i = 0; i < fjList.size(); i++) {
			fj=fjList.get(i);
		}
		XinWenLanMu lm = new XinWenLanMu();
		lm.setId(tp.getXwlmbh());
		List<XinWenLanMu> lmList=xwlmService.find(lm);
		for (int i = 0; i < lmList.size(); i++) {
			lm=lmList.get(i);
		}
		md.addAttribute("xwList",xwList);
		md.addAttribute("tp",fj);
		md.addAttribute("lm",lm);
		return "page/xwxq";
	}
	/**
	 * 跳转融资产品列表
	 * @param md
	 * @return
	 */
	@RequestMapping("/rzcplb")
	public String rzcplb(Model md){
		ChanPingFenLei fl = new ChanPingFenLei();
		List<ChanPingFenLei> flList = cpflService.find(fl);
		ChanPing cp = new ChanPing();
		cp.setFlbh("1");
		List<ChanPing> cpList = cpService.find(cp);
		md.addAttribute("flList",flList);
		md.addAttribute("cpList",cpList);
		return "page/rzcplb";
	}
	/**
	 * 跳转审核状态
	 * @param md
	 * @return
	 */
	@RequestMapping("/shzt")
	public String shzt(Model md){
		ChanPingFenLei fl = new ChanPingFenLei();
		List<ChanPingFenLei> flList = cpflService.find(fl);
		ChanPing cp = new ChanPing();
		cp.setFlbh("1");
		List<ChanPing> cpList = cpService.find(cp);
		md.addAttribute("flList",flList);
		md.addAttribute("cpList",cpList);
		return "page/shzt";
	}
	/**
	 * 跳转推荐产品
	 * @param md
	 * @return
	 */
	@RequestMapping("/tjcp")
	public String tjcp(Model md){
		ChanPingFenLei fl = new ChanPingFenLei();
		List<ChanPingFenLei> flList = cpflService.find(fl);
		ChanPing cp = new ChanPing();
		cp.setFlbh("1");
		List<ChanPing> cpList = cpService.find(cp);
		md.addAttribute("flList",flList);
		md.addAttribute("cpList",cpList);
		return "page/tjcp";
	}
	/**
	 * 跳转新闻列表
	 * @param md
	 * @return
	 */
	@RequestMapping("/xwzx")
	public String xwlb(Model md){
		XinWenLanMu o = new XinWenLanMu();
		o.setUpid("0");
		List<XinWenLanMu> lmList = xwlmService.find(o);
		XinWenZiXun neirong = new XinWenZiXun();
		neirong.setXwlmbh("6");
		List<XinWenZiXun> neirongList = xwzxService.find(neirong);
		md.addAttribute("lmList",lmList);
		md.addAttribute("neirongList",neirongList);
		return "page/xwzx";
	}
	/**
	 * 跳转注册状态我的
	 * @param md
	 * @return
	 */
	@RequestMapping("/zcztwd")
	public String zcztwd(Model md){
		return "page/zcztwd";
	}
	/**
	 * 跳转帮助中心
	 * @param md
	 * @return
	 */
	@RequestMapping("/bzzx")
	public String bzzx(Model md){
		return "page/bzzx";
	}
	/**
	 * 跳转企业用户
	 * @param md
	 * @return
	 */
	@RequestMapping("/qyyh")
	public String qyyh(Model md){
		return "page/qyyh";
	}
	/**
	 * 跳转产品上传
	 * @param md
	 * @return
	 */
	@RequestMapping("/cpsc")
	public String cpsc(Model md){
		return "page/cpsc";
	}
	/**
	 * 跳转对接成功项目
	 * @param md
	 * @return
	 */
	@RequestMapping("/djcgxm")
	public String djcgxm(Model md){
		return "page/djcgxm";
	}
	/**
	 * 跳转对接结果-企业
	 * @param md
	 * @return
	 */
	@RequestMapping("/djjgqy")
	public String djjgqy(Model md){
		return "page/djjgqy";
	}
	/**
	 * 跳转登录
	 * @param md
	 * @return
	 */
	@RequestMapping("/dl")
	public String dl(Model md){
		return "page/dl";
	}
	/**
	 * 跳转服务评级
	 * @param md
	 * @return
	 */
	@RequestMapping("/fwpj")
	public String fwpj(Model md){
		return "page/fwpj";
	}
	/**
	 * 跳转国家政策
	 * @param md
	 * @return
	 */
	@RequestMapping("/gjzc")
	public String gjzc(Model md){
		return "page/gjzc";
	}
	/**
	 * 跳转角色选择
	 * @param md
	 * @return
	 */
	@RequestMapping("/jsxz")
	public String jsxz(Model md){
		return "page/jsxz";
	}
	/**
	 * 跳转诉求建议
	 * @param md
	 * @return
	 */
	@RequestMapping("/sqjy")
	public String sqjy(Model md){
		return "page/sqjy";
	}
}
